/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.model;

/**
 * Training preference.
 *
 * @author <a href="mailto:malonso@silenus-consultoria.es">Mariano Alonso</a>
 * @since 03-abr-2009 20:47:42
 */
public enum TrainingPreference implements IntegerEnumeration, java.io.Serializable {
/**
   * Presential course or training.
   */
	PRESENTIAL(1, "training.presential"), 
/**
   * Remote course or training.
   */
	REMOTE(2, "training.remote"), 
/**
   * Mixed course or training.
   */
	MIXED(3, "training.mixed");
	/**
	 * The identifier.
	 */
	private final int id;

	/**
	 * The description.
	 */
	private final String key;

/**
   * Constructor.
   *
   * @param id  the id.
   * @param key the key.
   */
	TrainingPreference(final int id, final String key) {
		this.id = id;
		this.key = key;
	}

	/**
	 * Retrieves the identifier.
	 *
	 * @return the identifier.
	 */
	public int getId() {
		return this.id;
	}

	/**
	 * Retrieves the description.
	 *
	 * @return the description.
	 */
	public String getKey() {
		return this.key;
	}

	/**
	 * Retrieves a value by its identifier.
	 *
	 * @param id the id.
	 *
	 * @return the origin.
	 */
	public static TrainingPreference getById(int id) {
		switch(id) {
			case 1:
				return PRESENTIAL;

			case 2:
				return REMOTE;

			case 3:
				return MIXED;
		}

		return null;
	}
}
